package com.google.android.material.datepicker;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import c.b.a.b.j;
import com.google.android.material.datepicker.h;
import java.util.Calendar;
import java.util.Locale;

class s extends RecyclerView.g<b> {
    /* access modifiers changed from: private */

    /* renamed from: c  reason: collision with root package name */
    public final h<?> f2274c;

    class a implements View.OnClickListener {

        /* renamed from: b  reason: collision with root package name */
        final /* synthetic */ int f2275b;

        a(int i) {
            this.f2275b = i;
        }

        public void onClick(View view) {
            s.this.f2274c.u(l.k(this.f2275b, s.this.f2274c.o().f2265d));
            s.this.f2274c.v(h.k.DAY);
        }
    }

    public static class b extends RecyclerView.d0 {
        final TextView t;

        b(TextView textView) {
            super(textView);
            this.t = textView;
        }
    }

    s(h<?> hVar) {
        this.f2274c = hVar;
    }

    private View.OnClickListener E(int i) {
        return new a(i);
    }

    /* access modifiers changed from: package-private */
    public int F(int i) {
        return i - this.f2274c.m().r().e;
    }

    /* access modifiers changed from: package-private */
    public int G(int i) {
        return this.f2274c.m().r().e + i;
    }

    /* renamed from: H */
    public void s(b bVar, int i) {
        int G = G(i);
        String string = bVar.t.getContext().getString(j.mtrl_picker_navigate_to_year_description);
        bVar.t.setText(String.format(Locale.getDefault(), "%d", new Object[]{Integer.valueOf(G)}));
        bVar.t.setContentDescription(String.format(string, new Object[]{Integer.valueOf(G)}));
        c n = this.f2274c.n();
        Calendar i2 = r.i();
        b bVar2 = i2.get(1) == G ? n.f : n.f2231d;
        for (Long longValue : this.f2274c.p().i()) {
            i2.setTimeInMillis(longValue.longValue());
            if (i2.get(1) == G) {
                bVar2 = n.e;
            }
        }
        bVar2.d(bVar.t);
        bVar.t.setOnClickListener(E(G));
    }

    /* renamed from: I */
    public b u(ViewGroup viewGroup, int i) {
        return new b((TextView) LayoutInflater.from(viewGroup.getContext()).inflate(c.b.a.b.h.mtrl_calendar_year, viewGroup, false));
    }

    public int g() {
        return this.f2274c.m().s();
    }
}
